// 基础配置
const baseConfig = {
  script: 'npm',
  args: 'start',
  cwd: __dirname,
  instances: 1,
  autorestart: true,
  watch: false,
  max_memory_restart: '1G',
  restart_delay: 5000,
  kill_timeout: 5000,
  wait_ready: true,
  listen_timeout: 10000,
  max_restarts: 0,
  min_uptime: '10s',
  env: {
    NODE_ENV: 'development'
  }
};

// 生成应用配置
const apps = [];
for (let i = 0; i < 6; i++) {
  apps.push({
    ...baseConfig,
    name: `wh5-electron-${i}`,
    env: {
      ...baseConfig.env,
      PROCESS_ID: i.toString(),
      PROCESS_ARG: i.toString(),
    },
    cron_restart: `${2 + i * 10} * * * *`, // 2, 12, 22, 32, 42
  });
}

module.exports = { apps };